/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package asteroidmining1;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;

/**
 *
 * @author IVAN
 */
public class Asteroid {

    //private double _cx, _cy, _x, _y, _r, _rGravity, _m, relatioRGravityField;
    private int _relation;
    private double _m;
    private Rectangle location;
    private Rectangle locationGravityField;
    private Color color;

    public Asteroid(int x, int y, int r, int relation) {
        location = new Rectangle(x - r, y - r, 2 * r, 2 * r);
        color = Color.BLUE;

        _relation = relation;
        locationGravityField = new Rectangle(x - (r * relation), y - (r * relation), 2 * (r * relation), 2 * (r * relation));
        
        _m = 35;
    }

    public void setColor(Color newColor) {
        color = newColor;
    }

    public int radius() {
        return location.width / 2;
    }

    public int radiusGravity() {
        return locationGravityField.width / 2;
    }

    public int x() {
        return location.x + radius();
    }

    public int y() {
        return location.y + radius();
    }

    public Rectangle region() {
        return location;
    }

    public void paint(Graphics g) {
        g.setColor(color);
        g.fillOval(location.x, location.y,
                location.width, location.height);

        g.drawOval(locationGravityField.x, locationGravityField.y,
                locationGravityField.width, locationGravityField.height);
    }

    protected void moveTo(int x, int y) {
        location.setLocation(x - radius(), y - radius());
    }

    protected Color getColor() {
        return color;
    }

    /**
     * @return the _m
     */
    public double getM() {
        return _m;
    }

    /**
     * @param m the _m to set
     */
    public void setM(double m) {
        this._m = m;
    }
}